<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>管理菜品</title>
	<style type="text/css">
		table { border-collapse:collapse; border:solid 1px black; }
        table th, table td { height:20px; border:solid 1px Black; padding: 10px; }
        td img { height: 100px; }
	</style>
</head>
<body>
	<p style="text-align:right;">当前商家: ${ merchant.mName }</p>
	<a href="../home">&lt;&lt; 返回首页</a>
	
	<a href="add">新增菜品</a>
	<form style="float:right;" action="search" method="post">
		<select name="dtype">
			<c:forEach items="${ dishTypes }" var="t">
				<option value="${ t.dishTypeNum }" ${ param.dtype eq t.dishTypeNum ? "selected=\"selected\"" : "" }>${ t.dishTypeName }</option>
			</c:forEach>
		</select>
		<input type="text" placeholder="输入菜名" name="dname" value="${ param.dname }" />
		<input type="submit" value="搜索"/>
	</form>
	
	<table style="clear:both;margin-top:10px;">
		<thead>
			<tr>
				<th>预览</th>
				<th>名称</th>
				<th>类型</th>
				<th>价格</th>
				<th></th>
				<th></th>
			</tr>
		</thead>
		<tbody>
		
			<c:forEach items="${ dishes }" var="d">
				<tr>
					<td><img src="../../local/${ d.dImage }"/></td>
					<td>${ d.dName }</td>
					<td>${ dishTypes.get(d.dType).dishTypeName }</td>
					<td>${ d.dPrice }</td>
					<td><a href="update?dId=${ d.dId }">更新</a></td>
					<td><a href="delete.action?dId=${ d.dId }">删除</a></td>
				</tr>
			</c:forEach>
		
			<!-- tr>
				<td><img src="../local/images/dishes/25a29122-4991-40dc-974a-d4cbfb8842ad.jpg"/></td>
				<td>新奥尔良烤鸡腿堡</td>
				<td>主食</td>
				<td>$12.88</td>
				<td><a href="update?dId=${ shenme }">更新</a></td>
				<td><a href="delete.action?dId=${ shenme }">删除</a></td>
			</tr -->
		</tbody>
	</table>
</body>
</html>